/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package swingDemoEvent;

/**
 *
 * @author Administrator
 */
import java.awt.Button;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import javax.swing.JButton;
import javax.swing.JFrame;

public class GridLayoutTest extends JFrame {

    public GridLayoutTest(String title) {
        //super(title);
        setSize(200, 200);
        setLocation(100, 50);
        setBackground(Color.RED);
        Font font1 = new Font("宋体", Font.PLAIN, 20);
        setFont(font1);
        JButton buttons[] = new JButton[8];
        buttons[0] = new JButton("aaaa");
        buttons[1] = new JButton("坤");
        buttons[2] = new JButton("艮");
        buttons[3] = new JButton("震");
        buttons[4] = new JButton("坎");
        buttons[5] = new JButton("离");
        buttons[6] = new JButton("巽");
        buttons[7] = new JButton("兑");

        setLayout(new GridLayout(4, 2));
        for (int i = 0; i < buttons.length; i++) {
            add(buttons[i]);
        }
        setVisible(true);
    }

    public static void main(String args[]) {
        GridLayoutTest f1 = new GridLayoutTest("hello");
    }
}
